namespace PProdAPI.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;
    using PProdAPI.Models;
    using System.Collections.Generic;

    internal sealed class Configuration : DbMigrationsConfiguration<PProdAPI.Models.PProdAPIContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
        }

        protected override void Seed(PProdAPI.Models.PProdAPIContext context)
        {
            var items = new List<item>()
            {
                new item() {Id = 0, ItemID = "07-6807-221"},
                new item() {Id = 1, ItemID = "07-6801-051"},
                new item() {Id = 2, ItemID = "07-3720-053"}
            };
            items.ForEach(i => context.items.Add(i));
            context.SaveChanges();

            var employees = new List<employee>()
            {
                new employee() {Id = 0, Name = "Chris Murphy", HireDate = DateTime.Parse("12/1/1990")},
                new employee() {Id = 1, Name = "Damon Vincent",  HireDate = DateTime.Parse("8/15/2013")}
            };
            employees.ForEach(i => context.employees.Add(i));
            context.SaveChanges();

            var machines = new List<machine>()
            {
                new machine() {Id = 0, MachineName = "Mill 1"},
                new machine() {Id = 1, MachineName = "Bagger 4"},
                new machine() {Id = 2, MachineName = "Dryer 2"}
            };
            machines.ForEach(i => context.machines.Add(i));
            context.SaveChanges();

            var shifts = new List<shift>()
            {
                new shift() {Id = 0, ShiftName = "Shift A", NickName = "A"},
            };
            shifts.ForEach(i => context.shifts.Add(i));

            context.SaveChanges();
        }
    }
}
